import axios from 'axios';
import qs from 'qs';
// let loc = 'http://192.168.1.72:8081/coin';
// let loc = "http://192.168.2.16:8081/coin";
let loc = "http://www.lalianjob.com/coin";
// export const local='http://192.168.1.72:8081/coin';
export const local = 'http://www.lalianjob.com/coin';
export const requestLogin = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/open/login`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res).catch((err) => err);
};
export const productDetail = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/open/productDetail`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const getIndex = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/open/index`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const register = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/open/register`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const sendCode = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/open/sendCode`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const sendRegisterCode = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/open/sendRegisterCode`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const userInfo = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/userInfo`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const retrieve = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/open/retrieve`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const retrievePay = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/open/retrievePay`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const userAddrs = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/userAddrs`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const sysAddrs = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/sysAddrs`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const authentication = data => {
    return axios({
        method: 'post',
        url: `${loc}/api/user/authentication`,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;'
        },
        // withCredentials: true,
        data
    }).then((res) => res.data).catch((err) => err);
};
export const editUserInfo = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/userInfo`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const editUserPhotos = data => {
    return axios({
        method: 'post',
        url: `${loc}/api/userPhotos`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        data
    }).then((res) => res.data).catch((err) => err);
};
export const recharge = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/transact/recharge`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const withdraw = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/transact/withdraw`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const transactList = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/transact/list`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const purchase = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/prod/purchase`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const messageList = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/message/list`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const messageget = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/message/get`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const messageread = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/message/read`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const messagedel = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/message/del`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const opinionsend = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/opinion/send`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const addaddress = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/addr/add`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const updateaddress = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/addr/update`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const deladdress = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/addr/del`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const findaddress = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/addr/find`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const owned = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/prod/owned`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const onceOwned = params => {
    return axios({
        method: 'get',
        url: `${loc}/api/prod/onceOwned`,
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};
export const signature = params => {
    return axios({
        method: 'post',
        url: `${loc}/api/wxshare/signature`,
        headers: {
            'Content-type': "application/x-www-form-urlencoded"
        },
        // withCredentials: true,
        params
    }).then((res) => res.data).catch((err) => err);
};